<?php
	require_once( 'core_DataBaseConnect.php' );
	require_once( 'core_ErrorCode.php' );
	require_once( 'core_Response.php' );
	require_once( 'dao_FreeBoardDAO.php' );
	require_once( '_configs.php' );
	
	function func( $con, $post, $returnType )
	{
		// 기본 정보
		$result = FreeBoardDAO::selectFreeBoardDetail( $con, $post[ 'seq' ] );
		if( $fetch = DataBaseConnect::fetch_assoc( $result ) )
		{
			$response = DataBaseConnect::fetchSerialize( $fetch, array( 'SEQ', 'TITLE', 'DESC', 'REGIST_DATE', 'OWNER_ID', 'OWNER_NICKNAME' ) );
		}
		
		// 추가 썸네일 정보
		$result = FreeBoardDAO::selectThumnails( $con, $post[ 'seq' ] );
		$response[ 'thumbnails' ] = array();
		$response[ 'thumbnails' ][ 'thumb' ] = array();
		while( $fetch = DataBaseConnect::fetch_assoc( $result ) )
		{
			array_push( $response[ 'thumbnails' ][ 'thumb' ], DataBaseConnect::fetchSerialize( $fetch, array( 'SEQ', 'LINK' ) ) );
		}
		
		return Response::SUCCESS( $response, $returnType );
	}
?>